
export function toWMD(str: number): string {
  // 接受一个时间戳 (以秒为单位的时间戳)
  // 根据这个时间戳创建出一个时间对象
  const time = new Date(str * 1000)

  let week = '';
  switch (time.getDay()) {
    case 0:
      week = '周日'
      break;
    case 1:
      week = '周一'
      break;
    case 2:
      week = '周二'
      break;
    case 3:
      week = '周三'
      break;
    case 4:
      week = '周四'
      break;
    case 5:
      week = '周五'
      break;
    case 6:
      week = '周六'
      break;
  }
  // 时间格式
  return `${week} ${time.getMonth() + 1}月${time.getDate()}日`
}
export function toYMD(str: number): string {
  const time = new Date(str * 1000)
  return `${time.getFullYear()}年${time.getMonth() + 1}月${time.getDate()}日`
}
export function toMD(str: number): string {
  const time = new Date(str * 1000)
  return `${time.getMonth() + 1}月${time.getDate()}日`
}
export function toHM(str: number): string {
  const time = new Date(str * 1000)

  let hh = time.getHours() < 10 ? '0' + time.getHours() : time.getHours();
  let mm = time.getMinutes() < 10 ? '0' + time.getMinutes() : time.getMinutes();

  return `${hh}:${mm}`
}
